package com.acmen.easyapi.enums;

/**
 * @author acmen
 * 基础响应代码
 */
public enum BasicCode {
    SUCCESS(200, "操作成功"),

    BAD_REQUEST(400, "当前请求无法被服务器理解"),
    UNAUTHORIZED(401, "当前请求需要用户验证"),
    FORBIDDEN(403, "无权限访问当前资源"),
    NOT_FOUND(404, "请求失败，请求所希望得到的资源未被在服务器上发现"),
    INVALID_REQUEST(405, "非法请求"),
    LOGIN_FAILURE(406, "登录失败"),
    JWT_TIMEOUT(407, "JWT已过期"),
    SIGNATURE_ERROR(408, "签名异常"),


    FAILURE(500, "操作失败"),
    NPE(501, "空指针错误"),
    INVALID_PARAM(502, "非法参数"),
    PARAM_VALIDATE_ERROR(503, "参数校验错误"),
    UNKNOWN_ERROR(505, "未知系统错误"),


    RPC_DISABLED(601, "远程服务不可用"),
    RPC_TIMEOUT(602, "远程服务调用超时"),
    RPC_REQUEST_FUSING(603, "远程服务调用熔断异常"),
    RPC_ERROR(604, "远程服务调用错误"),


    API_CURRENT_LIMITING(701, "接口限流保护"),
    API_SERVICE_DOWNGRADE(702, "接口服务降级");

    private final Integer code;
    private final String desc;

    BasicCode(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
